package org.dna.uimodel;

import org.apache.wicket.model.LoadableDetachableModel;
import org.dna.MetroApplication;
import org.dna.metronomo.persistence.User;

/**
 * Implementation of a LoadableDetachableModel for the User entity.
 * */
public class LoadableUserModel extends LoadableDetachableModel<User> {

	private static final long serialVersionUID = 5671277538861904546L;
	private int m_id;

	public LoadableUserModel(User user) {
		super(user);
		m_id = user.getId();
	}

	@Override
	protected User load() {
		User user = MetroApplication.get().getUserDAO().findByID(m_id);
		return new SelectableUser(user);
	}
}
